﻿using System;
using System.Collections.Generic;
using UnityEngine;

namespace H
{
	// Token: 0x02000261 RID: 609
	internal class H_State_Insert : H_State
	{
		// Token: 0x0600100C RID: 4108 RVA: 0x00066E98 File Offset: 0x00065098
		public H_State_Insert(H_Members members) : base(members)
		{
		}

		// Token: 0x0600100D RID: 4109 RVA: 0x00066EA4 File Offset: 0x000650A4
		public override void In(H_State.Message msg)
		{
			this.inserted = false;
			this.members.param.anyAction = true;
			if ((this.members.StyleData.detailFlag & 4096) != 0)
			{
				this.Insert();
				base.ChangeState(H_STATE.INSERTED_WAIT);
				return;
			}
			this.timer = 0f;
			this.members.PlayAnime("Insert", 0.2f);
		}

		// Token: 0x0600100E RID: 4110 RVA: 0x00066F14 File Offset: 0x00065114
		public override void Main()
		{
			if (!this.inserted)
			{
				this.timer += Time.deltaTime;
				if (this.timer >= this.members.StyleData.insertDelay)
				{
					this.Insert();
				}
			}
			else if (this.members.CheckEndAnime("Insert"))
			{
				base.ChangeState(H_STATE.INSERTED_WAIT);
			}
		}

		// Token: 0x0600100F RID: 4111 RVA: 0x00066F80 File Offset: 0x00065180
		private void Insert()
		{
			this.members.param.mouth = this.members.StyleData.GetInsertedMouth();
			this.members.VoiceExpression(H_Voice.TYPE.INSERT);
			this.members.EnableTinIK = true;
			List<Female> females = this.members.GetFemales();
			bool flag = (this.members.StyleData.detailFlag & 16) != 0;
			bool flag2 = (this.members.StyleData.detailFlag & 32) != 0;
			for (int i = 0; i < females.Count; i++)
			{
				if (flag)
				{
					females[i].personality.insertVagina = true;
					if (females[i].personality.vaginaVirgin)
					{
						females[i].personality.LostVaginaVirgin();
						females[i].SetVirginBlood(true);
					}
				}
				if (flag2)
				{
					females[i].personality.insertAnal = true;
					if (females[i].personality.analVirgin)
					{
						females[i].personality.LostAnalVirgin();
					}
				}
			}
			this.members.MaleExpression(H_Expression_Male.TYPE.NORMAL);
			this.inserted = true;
		}

		// Token: 0x0400115D RID: 4445
		private float timer;

		// Token: 0x0400115E RID: 4446
		private bool inserted;
	}
}
